<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="dashboard/header :: header"></head>
<body>

	<!--
@desc  更新
@author WeiXiaoJin
@since 2019-05-18 23:04:49
-->
	<div layout:fragment="content">
		<div class="container-fluid content-main">
			<div class="animated fadeIn">
				<div class="row">
					<!-- /.col-->
					<div class="col-sm-12">
						<div class="card">
							<div class="card-body">

								<form class="form-horizontal" id="addForm"
									style="float: left; width: 100%">

									<input type="hidden" name="formToken"
										th:value="${session.formToken}" /> <input type="hidden"
										name="id" th:value="${bean.id}" />

									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">菜单名称</label>
										<div class="col-md-9">
											<input class="form-control" id="menusName" type="text"
												name="menusName" th:value="${ bean.menusName}"
												placeholder="菜单名称">
										</div>
									</div>
									<!-- 
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">菜单图标</label>
										<div class="col-md-9">
											<input class="form-control" id="menusIcons" type="text"
												name="menusIcons" th:value="${ bean.menusIcons}"
												placeholder="菜单图标">
										</div>
									</div>
									 -->
									 
									 
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label" for="text-input">图标</label>
										<div class="col-md-9">
											<span class="form-control select-icons" id="menusIconsLabel" type="text" 
											       onclick="showFontIcons('menusIcons','50')" 
											       name="menusIconsLabel" 
												   readonly="readonly" style="cursor: pointer;color:#02619a;padding-top: 6px;text-align:center"  placeholder="图标">
											      <i th:class="${ bean.menusIcons}" style="font-size:50px" aria-hidden="true"></i>
											</span>
											<input type="hidden" name="menusIcons" id="menusIcons" th:value="${ bean.menusIcons}" />
										</div>
									</div>
									
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">菜单链接</label>
										<div class="col-md-9">
											<input class="form-control" id="menusLink" type="text"
												name="menusLink" th:value="${ bean.menusLink}"
												placeholder="菜单链接">
										</div>
									</div>
									
									<!-- 
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">打开目标</label>
										<div class="col-md-9">
											<input class="form-control" id="openTarget" type="text"
												name="openTarget" th:value="${ bean.openTarget}"
												placeholder="打开目标">
										</div>
									</div>
									-->
									 
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label" for="text-input">主导航</label>
										<div class="col-md-9">
											<!-- 
											<input class="form-control" id="hasNav" type="text" name="hasNav" th:value="${ bean.hasNav}" placeholder="是否主导航">
											 -->
											<label class="checkbox-inline"><input type="checkbox" value="1" name="hasNav" id="hasNav" th:checked="${bean.hasNav eq '1'}">是</label>
										</div>
									</div>
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label" for="text-input">排序顺序</label>
										<div class="col-md-9">
											<input class="form-control" id="menusSort" type="text"
												name="menusSort" th:value="${ bean.menusSort}"
												placeholder="排序顺序">
										</div>
									</div>
									
									<!-- 
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">所属类型</label>
										<div class="col-md-9">
											<input class="form-control" id="typeId" type="text"
												name="typeId" th:value="${ bean.typeId}" placeholder="所属类型">
										</div>
									</div>
									
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label"
											for="text-input">菜单类型规划状态</label>
										<div class="col-md-9">
											<input class="form-control" id="menusDesignStatus"
												type="text" name="menusDesignStatus"
												th:value="${ bean.menusDesignStatus}" placeholder="菜单类型规划状态">
										</div>
									</div>
									 -->
									
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label" for="text-input">父类</label>
										<div class="col-md-9">
											<!-- 
											<input class="form-control" id="parentMenusId" type="text" name="parentMenusId" placeholder="父类菜单">
											 -->
											 <select class="form-control" name="parentMenusId" id="parentMenusId">
												<option value="0">父类</option>
												<option th:each="item:${menus}" th:value="Java" th:text="${item.menusName}" th:selected="${item.id eq bean.parentMenusId}">Java</option>
											</select>
										</div>
									</div>
									
									<div class="form-group row margin-right-0">
										<label class="col-md-2 col-form-label control-label" for="text-input">打开目标</label>
										<div class="col-md-9">
											<!-- 
											<input class="form-control" id="openTarget" type="text" name="openTarget" placeholder="打开目标">
											 -->
											 <div class="radio">
												<label class="checkbox-inline"><input type="radio" value="_blank" name="openTarget" id="openTarget"> 新标签</label>
											</div>
											<div class="radio">
												<label class="checkbox-inline"><input type="radio" value="_self" name="openTarget" id="openTarget" checked="checked"> 本窗口</label>
											</div>
										</div>
									</div>

								</form>
							</div>
							<!-- 
							<div class="card-footer">
								<button class="btn btn-primary" style="float:right" onclick="update()" type="button">更新</button>
							</div>
 -->
						</div>
					</div>
					<!-- /.col-->
				</div>
			</div>
		</div>

	</div>

	<footer th:replace="dashboard/footer :: footer"></footer>
	<script type="text/javascript" th:src="@{/resources/js/project.js}"></script>

	<script type="text/javascript">
		var addForm = $("#addForm") ; 
		$(function(){
			addForm.validate({
				ignore: [],  
				rules: {
					menusName: "required" ,
					menusIcons: "required" ,
					menusLink: {required:true} ,
					openTarget: "required" ,
					typeId : "required" ,
					parentMenusId : "required" ,
					menusSort : {required:true,number:true} ,
				}
			});
		}) ;

		function submitHandler() {
			var result = $.validate.form("addForm");
			if(result){
				$.operate.save(ctx + "portal/desktop/web/menus/update", $( '#addForm').serialize());
			}
		}
	</script>


</body>
</html>

